package com.codi.admin.controller;

import com.codi.bus.core.resultModel.BaseResult;
import com.codi.bus.core.service.T0Service;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 模块名
 *
 * @author spy
 * @version 1.0 2017-12-12 17:23
 * @since 1.0
 */
@Slf4j
@RestController
@RequestMapping("/admin/config")
public class ConfigController {

    @Autowired
    private T0Service t0Service;

    @PostMapping("/set_t0")
    public BaseResult setT0Config(@RequestParam(value = "fundCode", defaultValue = "-1") String fundCode) {

        return t0Service.configAppHomeConfig(fundCode);
    }


    @GetMapping("/t0_list")
    public BaseResult queryT0List(boolean isOrg) {

        return t0Service.configT0List(isOrg);
    }


    @GetMapping("/get_t0_fund_trade_limit")
    public BaseResult getTOFundTradeLimit(@RequestParam(value = "fundCode", defaultValue = "-1") String fundCode) {
        return t0Service.getTOFundTradeLimit(fundCode);
    }

    @PostMapping("/add_or_update_t0_fund_trade_limit")
    public BaseResult updateT0FundTradeLimitByFundCode(String fundCode, String minMoney, String userOrOrg, String reminder) {
        return t0Service.setT0FundTradeLimit(fundCode.trim(), minMoney.trim(), userOrOrg.trim(), reminder);
    }
}
